<?php

/**
 * 自定义资料
 *
 * @package         YDCMS
 * @author          QQ:644157559 <644157559@qq.com>
 * @version         $Id: MylangService.class.php v1.0 2014-06-13 17:27:03 $
 */
namespace Admin\Service;
class MylangService extends CommonService{
    
    /**
     * 数据入库
     * @param type $data
     * @return type
     */
    public function add($data) {
        $MylangModel = $this->getD();
        if(false === ($mylang = $MylangModel->create($data))){
            return $this->errorResultReturn($MylangModel->getError());
        }
        if(false == $MylangModel->add($mylang)){
            return $this->errorResultReturn("系统繁忙！");
        }
        
        return $this->resultReturn(TRUE);
    }
    /**
     * 数据更新
     * @param type $data
     * @return type
     */
    public function update($data) {
        $MylangModel = $this->getD();
        if(false === ($mylang = $MylangModel->create($data))){
            return $this->errorResultReturn($MylangModel->getError());
        }
        if(false == $MylangModel->save($mylang)){
            return $this->errorResultReturn("系统繁忙！");
        }
        
        return $this->resultReturn(TRUE);
    }
    
    /**
     * 根据ID获取详情
     * @param type $id
     * @return type
     */
    public function getById($id) {
        return $this->getM()->getById($id);
    }
    
    /**
     * 删除
     * @param type $id
     * @return type
     */
    public function delete($id) {
        return $this->getM()->delete($id);
    }
    protected function getModelName() {
        return "Mylang";
    }
}
